
--[[
 XDMA 数据校对脚本

	校对规则： 校对每行前七个字符串是否为 (0003000)
	将不匹配的行数输出到 result.txt 中
--]]



local filename = "cData0.bin"
local count_filename = "result.txt"



local file = io.open(filename,"r")
local res_file = io.open(count_filename,"w")


local line = 1

while (true) do
	local xdma_str = file:read()
	if(xdma_str == nil)
	then
		break
	end

	if (string.match(xdma_str,"0003000") == nil)
	then
		res_file:write(line.."\n")
	end
	line = line + 1


end

file:close()
res_file:close()
